@extends('layouts.admin.application')
@section('content')

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">BMI变化</strong> /
                    <small>List</small>
                </div>
            </div>
            @include('admin._flash')
            <hr>

            <body>
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="yue" style="width: 1750px;height:400px;"></div>

            </body>





        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


@endsection
@section('js')
    <script>
        $(function () {



            //改变性别
            $('.change_attr').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/oncustomer/change_attr',
                    data: {id: id},
                    success: function () {
                        _this.toggleClass('am-icon-male am-icon-female');
                        location.href = location.href;

                    }
                })

            })


        })




        var yueChart = echarts.init(document.getElementById('yue'));
        $.get('https://www.mf.seleted.cn/api/bmi_record/{{$id}}').done(function (data) {

            var option = {
                title: {
                    text: 'Bmi变化'
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['搜索引擎']
                },
                grid: {
                    left: '3%',
                    right: '10%',
                    bottom: '10%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: data.time
                },
                yAxis: {
                    type: 'value'
                },
                series: [

                    {
                        name:'指数',
                        type:'line',
                        stack: '总量',
                        data: data.data
                    }
                ]
            };


            yueChart.setOption(option);
        });





    </script>
@endsection